<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>美食派系统-新增类目</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="media/layui/css/layui.css" media="all">
<script type="text/javascript" src="media/js/jquery.min.js"></script>
</head>
<body>
	<div class="layui-container" style="margin-top: 50px;">
		<form class="layui-form"  id="form1" onsubmit="return false">
			<div class="layui-form-item">
				<label class="layui-form-label">类目编号</label>
				<div class="layui-input-block">
					<input type="text" name="categoryType" lay-verify="name" autocomplete="off"
						placeholder="类目编号" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">类目名称</label>
				<div class="layui-input-block">
					<input type="text" name="categoryName" lay-verify="name" autocomplete="off"
						placeholder="请输入类目名称" class="layui-input">
				</div>
			</div>

			<div class="layui-btn-group">
				<div class="layui-form-item layui-col-md3">
					<input class="layui-btn" type="submit" id="submit1" value="确认新增">
				</div>
			</div>
		</form>
	</div>


	<script src="media/layui/layui.js"></script>
	<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
	<script>

		$("#submit1").click(function () {
			$.ajax({
				type:'post',
				url:'meishipai/product-category/addCategory',
				data:$("#form1").serialize(),
				dataType:'json',
				success:function (data) {
					if (data.code == 0) {
						alert(data.msg)
						window.location.href = "category.html"
					} else {
						alert(data.info)
					}
				}
			})
			return false;
		})
	</script>
</body>
</html>
